package com.tianhui.consignortwofei.mvp.model;

import android.content.Context;

import com.fgs.common.CommonModel;
import com.fgs.common.api.CommonApiService;
import com.fgs.common.api.CommonConfig;
import com.fgs.common.progress.ObserverResponseListener;
import com.tianhui.consignortwofei.api.OrderApiService;
import com.tianhui.consignortwofei.mvp.model.enty.evaluation.EvaluationInfo;

import java.util.List;
import java.util.Map;

import io.reactivex.ObservableTransformer;
import okhttp3.MultipartBody;

/**
 * @author fgs
 * @date 2020/5/6
 * @description
 **/
public class EvaluationModel<T> extends CommonModel implements IPictureModel<T>,IDictionaryModel<T>{
    /**
     * 发表评价
     *
     * @param context
     * @param info
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void evaluationCommitModel(Context context, EvaluationInfo info, boolean isDialog,
                                      ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        //当不需要指定是否由dialog时，可以调用这个方法
        subscribe(context,  CommonConfig.getInstance().create(OrderApiService.class).publishEvaluation(info), observerListener, transformer, isDialog, true);
    }

    @Override
    public void dictionaryModel(Context context, Map<String, String> map, boolean isDialog, ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {
        subscribe(context, CommonConfig.getInstance().create(OrderApiService.class).dictionaryList(map), observerListener, transformer, isDialog, true);

    }

    @Override
    public void uploadPictureModel(Context context, List<MultipartBody.Part> parts, boolean isDialog, ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {
        subscribe(context, CommonConfig.getInstance().create(CommonApiService.class).uploadPicture(parts), observerListener, transformer, isDialog, true);
    }
}
